//
//  ViewController.m
//  CPDropdownView
//
//  Created by 美鑫科技 on 16/5/9.
//  Copyright © 2016年 MorpLCP. All rights reserved.
//

#import "ViewController.h"
#import "CPDropDownView.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    CPDropDownView *view = [[CPDropDownView alloc] initWithFrame:CGRectMake(0, -self.view.frame.size.height, self.view.frame.size.width, self.view.frame.size.height) ReferenceView:self.view];
    view.tag = 1008;
    view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.6];
    view.magnitude = 0.5;
    view.duration = 0.5;
    view.direction = CPDropDirectionFromTop;
    [self.view addSubview:view];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    CPDropDownView *v = (CPDropDownView *)[self.view viewWithTag:1008];
    static int i = 0;
    if (i == 0) {
         [v  showDropView];
        i = 1;
    } else{
        [v dismissDropView];
        i = 0;
    }
   
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

@end
